﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using RAP.Framework.Libary.Utils;

namespace RAP.Framework.Libary.Payment.WxPay
{
  /// <summary>
  /// 订单下单数据实体
  /// </summary>
  public class PayOrderRequestData : PayDataBase
  {
    /// <summary>
    /// 生成签名的APPKey
    /// </summary>
    public string AppKey { get; set; }

    /// <summary>
    /// 签名类型，目前支持HMAC-SHA256和MD5，默认为MD5
    /// </summary>
    public string SignType { get => this.ToString("sign_type"); set => this["sign_type"] = value; }

    /// <summary>
    /// 商品描述
    /// </summary>
    public string Body { get => this.ToString("body"); set => this["body"] = value; }

    /// <summary>
    /// 商品详细描述，对于使用单品优惠的商户，该字段必须按照规范上传
    /// </summary>
    public string Detail { get => this.ToString("detail"); set => this["detail"] = value; }

    /// <summary>
    /// 附加数据，在查询API和支付通知中原样返回，该字段主要用于商户携带订单的自定义数据
    /// </summary>
    public string Attach { get => this.ToString("attach"); set => this["attach"] = value; }

    /// <summary>
    /// 商户系统内部订单号，要求32个字符内，只能是数字、大小写字母_-|*且在同一个商户号下唯一
    /// </summary>
    public string TradeNo { get => this.ToString("out_trade_no"); set => this["out_trade_no"] = value; }

    /// <summary>
    /// 符合ISO 4217标准的三位字母代码，默认人民币：CNY，其他值列表详见
    /// </summary>
    public string FeeType { get => this.ToString("fee_type"); set => this["fee_type"] = value; }

    /// <summary>
    /// 订单总金额，单位为分
    /// </summary>
    public int TotalFee { get => this.ToInt32("total_fee", 0); set => this["total_fee"] = value; }

    /// <summary>
    /// 调用微信支付API的终端IP
    /// </summary>
    public string ClientIP { get => this.ToString("spbill_create_ip"); set => this["spbill_create_ip"] = value; }

    /// <summary>
    /// 订单生成时间，格式为yyyyMMddHHmmss，如2009年12月25日9点10分10秒表示为20091225091010
    /// </summary>
    public string TimeStart { get => this.ToString("time_start"); set => this["time_start"] = value; }

    /// <summary>
    /// 订单失效时间，格式为yyyyMMddHHmmss，如2009年12月27日9点10分10秒表示为20091227091010。订单失效时间是针对订单号而言的，由于在请求支付的时候有一个必传参数prepay_id只有两小时的有效期，所以在重入时间超过2小时的时候需要重新请求下单接口获取新的prepay_id
    /// </summary>
    public string TimeExpire { get => this.ToString("time_expire"); set => this["time_expire"] = value; }

    /// <summary>
    /// 订单优惠标记，代金券或立减优惠功能的参数
    /// </summary>
    public string GoodsTag { get => this.ToString("goods_tag"); set => this["goods_tag"] = value; }

    /// <summary>
    /// 接收微信支付异步通知回调地址，通知url必须为直接可访问的url，不能携带参数
    /// </summary>
    public string NotifyUrl { get => this.ToString("notify_url"); set => this["notify_url"] = value; }

    /// <summary>
    /// 指定支付方式
    /// </summary>
    public string LimitPay { get => this.ToString("limit_pay"); set => this["limit_pay"] = value; }

    /// <summary>
    /// 开发票入口开放标识
    /// </summary>
    public string Receipt { get => this.ToString("receipt"); set => this["receipt"] = value; }

    public PayOrderRequestData()
    {
      
    }
  }
}
